﻿using FreeSql;
using FreeSql.Internal;
using System;
using System.Collections.Generic;

namespace TK.FreeSqlExtension
{
    /// <summary>
    /// ORM config
    /// </summary>
    public class OrmConfig
    {
        /// <summary>
        /// 数据库连接字符串列表
        /// </summary>
        public List<DbConnectionConfig> ConnectionList { get; set; } = new List<DbConnectionConfig>();

        /// <summary>
        /// 从库连接字符串，默认为null;从库只添加到第一个主库连接
        /// </summary>
        public string[] SlaveConnectionList { get; set; }
    }

    /// <summary>
    /// ORM config
    /// </summary>
    public class OrmBuilderConfig : OrmConfig
    {
        /// <summary>
        /// 自定义FreeSqlBuilder
        /// </summary>
        public Action<FreeSqlBuilder> BuilderAction { get; set; }

        /// <summary>
        /// freesql IAop 配置
        /// </summary>
        public Action<DataType, IAop> AopAction { get; set; }

        /// <summary>
        /// freesql GlobalFilter 配置
        /// </summary>
        public Action<DataType, GlobalFilter> GlobalFilterAction { get; set; }

        /// <summary>
        /// freesql ICodeFirst 配置
        /// </summary>
        public Action<DataType, ICodeFirst> CodeFirstAction { get; set; }
    }
}
